cmake_minimum_required(VERSION 3.10)

project(MyProject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(${PROJECT_SOURCE_DIR}/include)

find_package(PkgConfig REQUIRED)
pkg_check_modules(BUSINESS_FRAMEWORK REQUIRED IMPORTED_TARGET kyai-business-framework)
pkg_check_modules(DOCUMENT_SERVICE REQUIRED IMPORTED_TARGET kylin-ai-document-service)

add_executable(myapp src/main.cpp src/person.cpp)

target_link_libraries(myapp
        PRIVATE PkgConfig::BUSINESS_FRAMEWORK
        PRIVATE PkgConfig::DOCUMENT_SERVICE
        PRIVATE pthread)

install(TARGETS myapp
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

option(BUILD_TESTING "Build Test" OFF)
if (BUILD_TESTING)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
    enable_testing()
    add_subdirectory(tests)
endif ()